# from flask import  Blueprint,request,redirect,session,abort
# bp = Blueprint('login_bp',__name__,url_prefix='/user')
# from flask_login import login_required,login_user,logout_user
# from auth.login import *
# from blueprint.test_bp_impl import *
# from utils.decorator import *
#
# # 登陆请求
# @bp.route('/login',methods=['GET','POST'])
# @json_response
# def login():
#     login_name = request.args.get('login_name','')
#     password = request.args.get('password','')
#     if login_name == None or password == None or login_name =='' or password == '':
#         return dict(success=False, msg='wrong input data.',code=100)
#     try:
#         user = get_User(login_name,password)
#         if not user or not user.is_authenticated:
#             return dict(success=False, msg='login failed!',code=200)
#         login_user(user)
#         session['login_name'] = login_name
#         session['is_admin'] = user.id_admin
#         # print(session)
#         return dict(success=True, data='login done.')
#     except Exception as err:
#         return dict(success=False, msg='login failed!',code=200)
#
#
# # 登出请求
# @bp.route('/logout',methods=['GET','POST'])
# @json_response
# @login_required
# def logout():
#     # _user_id为flask——login中固定的key。
#     try:
#         logout_user()
#         return dict(success=True, data='logout OK.')
#     except Exception as err:
#         return dict(success=False, msg='logout failed!', code=300)
#
